package com.frontyard.chatty.util;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;


public class SocketUtil {
    
    public static ServerSocket createServer(int port) throws IOException {
        return new ServerSocket(port);
    }

    public static Socket createAndConnect(String host, int port) throws IOException {
        Socket socket = null;
        
        try {
            socket = new Socket(host, port);
        } catch (UnknownHostException e) {
            throw new IOException(e.getMessage(), e);
        }
        
        return socket;
    }
    
}
